package com.jyw.system.domain.dto;

import com.jyw.common.core.domain.entity.SysUser;
import com.jyw.common.utils.bean.BeanUtils;
import com.jyw.common.xss.Xss;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;
import java.util.List;

/**
 * @author 沈峻
 * @ClassName UserAddDto
 * @Description TODO
 * @Date 2023/8/9 14:38
 **/
@Data
@ApiModel("用户新增请求实体")
public class UserAddDto {
    @ApiModelProperty("用户昵称")
    @Xss(message = "用户昵称不能包含脚本字符")
    @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
    private String nickName;

    /**
     * 归属科室
     */
    @ApiModelProperty("归属科室")
    private Long deptId;

    @ApiModelProperty("其他科室")
    private List<Long> deptIdList;

    @ApiModelProperty("手机号码")
    @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
    @NotBlank(message = "手机号码不能为空")
    private String phonenumber;

    @ApiModelProperty("用户名称")
    @Xss(message = "用户账号不能包含脚本字符")
    @NotBlank(message = "用户账号不能为空")
    private String userName;

    @ApiModelProperty("用户密码")
    @Size(min = 5,message = "密码位数最小5位")
    private String password;

    @ApiModelProperty(value = "状态" ,notes = "0=正常,1=停用")
    private String status;


    public SysUser buildUser(){
        SysUser user = new SysUser();
        BeanUtils.copyProperties(this,user);
        return user;
    }
}
